package day3;

import java.util.*;

public class UVa514 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n;
		int i;
		int carriageInB;
		int[] carriage;
		Stack<Integer> carriageLeaveA;
		
		while(scan.hasNext()) {
			n = scan.nextInt();
			if(n == 0)
				break;
			
			carriage = new int[n];
			
			while((carriage[0] = scan.nextInt()) != 0) {
				for(i = 1; i < n; i++)
					carriage[i] = scan.nextInt();
				
				carriageInB = 0;
				carriageLeaveA = new Stack<Integer>();
				for(i = 1; i <= n; i++) {
					carriageLeaveA.push(i);

					while(!carriageLeaveA.isEmpty() && carriage[carriageInB] == carriageLeaveA.peek()) {
						carriageLeaveA.pop();
						carriageInB++;
					}
				}

				if(carriageInB == n) {
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			}
			
			System.out.println();
		}
	}
}